import {
    center,
    right,
    grid,
    input,
    button,
    search,
    header,
} from '@/css/DialogsCss.module.scss';
export default {
    title:'最新合同',
    dialog:{
        size:'50%'
    },
    onMounted: [{
        action: 'set',
        target: '$widgets.form',
        field: 'value',
        value: '$params'
    }],
    items: [{
        region: 'center',
        span: 10,
        class: center,
        layout: 'vertical',
        items: [{
            layout: 'vertical',
            items: [{
                id: 'form',
                widget: 'form',
                layout: {
                    type:'gridform',
                    column:2
                },
                fields:[{
                    class: input,
                    itemId: 'code',
                    placeholder:'请输入合同编号',
                    widget:'text',
                    label:'合同编号',
                },{
                    itemId: 'state',
                    widget:'form-radio',
                    label:'状态',
                    options:[{
                        value: 0,
                        text:'待处理'
                    },{
                        value: 1,
                        text:'已处理'
                    }]
                },{
                    class: input,
                    itemId: 'name',
                    placeholder:'请输入合同名称',
                    widget:'text',
                    label:'合同名称',
                },{
                    class: input,
                    itemId: 'customer_id',
                    placeholder:'请输入联客户',
                    widget:'text',
                    label:'联客户',
                },{
                    class: input,
                    itemId: 'amount_contract',
                    placeholder:'请输入合同金额',
                    widget:'text',
                    label:'合同金额',
                },{
                    class: input,
                    itemId: 'amount_return',
                    placeholder:'请输入回款金额',
                    widget:'text',
                    label:'回款金额',
                },{
                    class: input,
                    itemId: 'amount_arrears',
                    placeholder:'请输入欠费金额',
                    widget:'text',
                    label:'欠费金额',
                },{
                    class: input,
                    itemId: 'amount_invoice',
                    placeholder:'请输入开票金额',
                    widget:'text',
                    label:'开票金额',
                },{
                    class: input,
                    itemId: 'sign_time',
                    placeholder:'请输入签订时间',
                    widget:'form-datepicker',
                    label:'签订时间',
                },{
                    class: input,
                    itemId: 'expiration_time',
                    placeholder:'请输入到期时间',
                    widget:'form-datepicker',
                    label:'到期时间',
                },{
                    class: input,
                    itemId: 'remarks',
                    placeholder:'请输入备注说明',
                    widget:'text',
                    label:'备注说明',
                }],
                buttons: [{
                    value: '保存',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            action: 'service',
                            path: 'saleManage/contract/latestContract/save',
                            params: '$widget.value', 
                        }, {
                            action: 'message',
                            message: '保存成功',
                            type: 'success'
                        }, {
                            action: 'service',
                            path: 'saleManage/contract/latestContract/list',
                            params:{
                                page_size:'$widgets.grid.pageSize',
                                page_no:'$widgets.grid.page',
                                keywords: '$widgets.search.value.keywords',
                                is_show: '$widgets.search.value.is_show',
                            },
                            actions: [{
                                action:'set',
                                target:'$widgets.grid',
                                field:'value',
                                value:'$params.data.items'
                            },{
                                action:'set',
                                target:'$widgets.grid',
                                field:'total',
                                value:'$params.data.total'
                            }]
                        },{
                            action:'dialog-hide',
                            mode:'apply'
                        }]
                    }]
                }],
                flex: true
            }]
        }]
    }]
};


